<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
 
// import Joomla view library
jimport('joomla.application.component.view');
 
/**
 * Categorys View
 */
class ShopViewMethods extends JView
{
	/**
	 * Category view display method
	 * @return void
	 */
	function display($tpl = null) 
	{
	 // Get data from the model
		$this->items = $this->get('Items');
		$this->pagination = $this->get('Pagination');
 
		// Check for errors.
		
		if (count($errors = $this->get('Errors'))) 
		{
			JError::raiseError(500, implode('<br />', $errors));
			return false;
		}
 
 		$this->addToolBar();
		ShopHelper::addSubmenu('methods');
		// Display the template
		parent::display($tpl);
	}
	/**
	 * Setting the toolbar
	 */
	protected function addToolBar() 
	{			
		JToolBarHelper::title(JText::_('COM_SHOP_METHOD_TITLE'),'method');
		$canDo = ShopHelper::getActions();
		if ($canDo->get('core.create')) 
		{
			JToolBarHelper::addNew('method.add');
		}
		if ($canDo->get('core.edit')) 
		{
			JToolBarHelper::editList('method.edit');
		}
		if ($canDo->get('core.delete')) 
		{
			JToolBarHelper::deleteList('', 'methods.delete');
		}
		JToolBarHelper::divider();
		JToolBarHelper::back('Cpanel','index.php?option=com_shop');
		$document = JFactory::getDocument();
		$document->addStyleDeclaration('.icon-48-method {background-image: url(components/com_shop/images/method48x48.png);}');
	}

}